import { Navigate } from "react-router-dom";
import { RouteItemType } from "@/routers/interface/index.ts";
import { HOME_PATH, LOGIN_PATH, REGISTER_PATH } from "@/config/index.ts";
import LoginPage from "@/views/login/index.tsx";
import RegisterPage from "@/views/register/index.tsx";
import NotAuthPage from "@/views/error/notAuth.tsx";
import NotFoundPage from "@/views/error/notFound.tsx";
import NotNetworkPage from "@/views/error/notNetwork.tsx";

// 配置静态路由表
const staticRoutes: RouteItemType[] = [
  {
    path: "/",
    element: <Navigate to={HOME_PATH} replace={true}></Navigate>,
  },
  {
    path: LOGIN_PATH,
    element: <LoginPage></LoginPage>,
    meta: {
      title: "登录",
    },
  },
  {
    path: REGISTER_PATH,
    element: <RegisterPage></RegisterPage>,
    meta: {
      title: "注册",
    },
  },
  {
    path: "/403",
    element: <NotAuthPage></NotAuthPage>,
    meta: {
      title: "403",
    },
  },
  {
    path: "/404",
    element: <NotFoundPage></NotFoundPage>,
    meta: {
      title: "404",
    },
  },
  {
    path: "/500",
    element: <NotNetworkPage></NotNetworkPage>,
    meta: {
      title: "500",
    },
  },
  {
    path: "*",
    element: <Navigate to={"/404"}></Navigate>,
  },
];

export default staticRoutes;

// export const publicRoutes = staticRoutes.map((route) => {
//   return {
//     ...route,
//     element: <RouterGuard>{route.element}</RouterGuard>,
//     loader: () => {
//       return { ...route.meta }
//     }
//   }
// })
